package com.mystore.framework.pojo;

import java.io.Serializable;
import java.util.Objects;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Setter;
import lombok.Getter;
import org.jetbrains.annotations.NotNull;
import org.springframework.cache.annotation.Cacheable;

/**
 * URI表(Uri)实体类
 *
 * @author MyStore
 * @since 2023-06-28 14:04:58
 */

@Getter
@Setter
@Cacheable("uri")
public class Uri implements Serializable,Comparable<Uri> {
    private static final long serialVersionUID = 788424999840101832L;
    /**
     * URI ID
     */
    @TableId(type = IdType.AUTO)
    private Integer uriId;
    /**
     * URI地址
     */
    private String uriLocation;


    @Override
    public int compareTo(@NotNull Uri o) {
        return uriId.compareTo(o.uriId);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Uri uri = (Uri) o;
        return Objects.equals(uriId, uri.uriId) && Objects.equals(uriLocation, uri.uriLocation);
    }

    @Override
    public int hashCode() {
        return Objects.hash(uriId, uriLocation);
    }
}

